package com.itheima.mall.service.smsService;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.itheima.pojo.sms.SmsCouponProductCategoryRelation;
import com.itheima.mall.mapper.smsMapper.SmsCouponProductCategoryRelationMapper;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

@DubboService
public class SmsCouponProductCategoryRelationlmpl extends ServiceImpl<SmsCouponProductCategoryRelationMapper, SmsCouponProductCategoryRelation> implements SmsCouponProductCategoryRelationApi {
    @Autowired
    private  SmsCouponProductCategoryRelationMapper smsCouponProductCategoryRelationMapper;
    @Override
    public void createCoupon(SmsCouponProductCategoryRelation smsCouponProductCategoryRelation) {
        smsCouponProductCategoryRelationMapper.insert(smsCouponProductCategoryRelation);
    }
    @Override
    public void updateByIds(SmsCouponProductCategoryRelation couponProductCategoryRelation) {
        smsCouponProductCategoryRelationMapper.updateById(couponProductCategoryRelation);
    }

    //获取单个优惠卷的详细信息
    @Override
    public List<SmsCouponProductCategoryRelation> getByCoupon(Long id) {
        LambdaQueryWrapper<SmsCouponProductCategoryRelation> wrapper = new LambdaQueryWrapper();
        wrapper.eq(SmsCouponProductCategoryRelation::getCouponId,id);
        List<SmsCouponProductCategoryRelation> list = smsCouponProductCategoryRelationMapper.selectList(wrapper);
        return list;
    }
}
